<?php
class OrgController extends Controller{
    public function beforeRender($view) {
        parent::beforeRender($view);
        if(!isset(Yii::app()->user->id) && Yii::app()->controller->action->id !='login'){
            $this->redirect (Yii::app ()->createAbsoluteUrl ('organizer/login'));
        }else{
            if(isset(Yii::app()->user->id) && Yii::app()->controller->action->id =='login'){
                $this->redirect (Yii::app ()->createAbsoluteUrl ('organizer/index'));
            }
            if(isset(Yii::app()->user->role_id) && Yii::app()->user->role_id >2 ){
                MyFunctionCustom::checkAccess(Yii::app()->user->role_id);
            }
        }
        return true;
    }
}